package com.vueperson.vueperson.services.handle;

import com.vueperson.vueperson.dao.RoleJPA02;
import com.vueperson.vueperson.dao.UserJPA02;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class Role02_2 implements Role2 {
    @Autowired
    UserJPA02 userJPA;
    @Autowired
    RoleJPA02 roleJPA;
    @Override
    public Boolean haveUser(String name) {
        Boolean f;
        if (userJPA.findByUsername(name).size()!=0){
            System.out.println("已有用户名");
            return f=true;
        };
        return f=false;
    }

    @Override
    public Boolean haveRole(String name) {
        Boolean f;
        if (roleJPA.findByName(name).size()!=0){
            System.out.println("已经有此角色");
            return f=true;
        };
        return f=false;
    }
}
